package classrecord.classes.database.common;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DaoManager {

	private Connection connection;

	public DaoManager() {

		// put value of database initialization name here.
		String databaseDriver = "org.sqlite.JDBC";
		String databaseUrl = "jdbc:sqlite:records.db.sqlite";

		try {
			Class.forName(databaseDriver);
			setConnection(DriverManager.getConnection(databaseUrl));
			connection.setAutoCommit(false);

		} catch (ClassNotFoundException e) {
			e.printStackTrace();

		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	public Connection getConnection() {
		return connection;
	}

	private void setConnection(Connection connection) {
		this.connection = connection;
	}

}
